package com.bestillet.defaultmultishop;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;

public class CommentDialog extends Dialog {
	private MixActivity context;
	private EditText comment;
	private Button add;
	
	private Mix mix;
	
	private View.OnClickListener listener = new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			mix.getChoice().setName(comment.getText().toString());
			context.updateChoices();
			dismiss();
		}
	};

	public CommentDialog(Context context, Mix mix) {
		super(context);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.dialog_comment);

		this.context = (MixActivity) context;
		this.mix = mix;
		
		comment = (EditText) findViewById(R.id.txtComment);
		comment.setText(mix.getChoice().getName());
		
		add = (Button) findViewById(R.id.btnAddComment);
		add.setOnClickListener(listener);
	}
}